/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mutual.entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author yue
 */
@Entity
@Table(name = "Parentescos")
@NamedQueries({
    @NamedQuery(name = "Parentescos.findAll", query = "SELECT p FROM Parentescos p"),
    @NamedQuery(name = "Parentescos.findById", query = "SELECT p FROM Parentescos p WHERE p.id = :id"),
    @NamedQuery(name = "Parentescos.findByParentesco", query = "SELECT p FROM Parentescos p WHERE p.parentesco = :parentesco")})
public class Parentescos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "parentesco")
    private String parentesco;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "parentescos")
    private Collection<Familiares> familiaresCollection;

    public Parentescos() {
    }

    public Parentescos(Integer id) {
        this.id = id;
    }

    public Parentescos(Integer id, String parentesco) {
        this.id = id;
        this.parentesco = parentesco;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getParentesco() {
        return parentesco;
    }

    public void setParentesco(String parentesco) {
        this.parentesco = parentesco;
    }

    public Collection<Familiares> getFamiliaresCollection() {
        return familiaresCollection;
    }

    public void setFamiliaresCollection(Collection<Familiares> familiaresCollection) {
        this.familiaresCollection = familiaresCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Parentescos)) {
            return false;
        }
        Parentescos other = (Parentescos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return parentesco;
    }

}
